package cn.stylefeng.guns.sys.modular.system.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.stylefeng.guns.sys.modular.system.mapper.ProjectBusinessViewMapper;
import cn.stylefeng.guns.sys.modular.system.model.params.ProDataViewParam;
import cn.stylefeng.guns.sys.modular.system.service.ProjectBusinessViewService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class ProjectBusinessViewServiceImpl implements ProjectBusinessViewService {
    private Logger logger = LoggerFactory.getLogger(ProjectBusinessViewServiceImpl.class);
    @Autowired
    private ProjectBusinessViewMapper projectBusinessViewMapper;


    @Override
    public  List<Map<String, Object>>  findAllShops(ProDataViewParam param) {

        if(param.getParam()!=null){
            param.setParam(param.getParam()-1);
        }

        if(CollectionUtil.isEmpty(param.getParamList())){
            return new ArrayList<Map<String, Object>>();
        }

        List<Map<String, Object>> dataResults=projectBusinessViewMapper.findShopsByParam(param);

        return dataResults;
    }

    @Override
    public List<Map<String, Object>> findShopsByParam(ProDataViewParam param) {

        List<Map<String, Object>> dataResults=projectBusinessViewMapper.findShops(param);

        return dataResults;
    }

    @Override
    public List<Integer> findShopIdsByParam(ProDataViewParam param) {

        List<Integer> dataResults=projectBusinessViewMapper.findShopIdsByParam(param);

        return dataResults;
    }
}
